Using mipmaps
Use mipmaps to create a set of downscaled sublevels from a large texture. Mipmaps increase the GPU memory use by one third, but improve the performance when the full texture does not have to be sampled. Use mipmaps to improve the performance whenever you scale a textured node.
For example, a 256 by 256 pixels texture has mipmap levels that reduce the texture to 128 by 128, 64 by 64, and so on until 1 by 1 pixel. The performance improves because smaller mipmap levels fit better in the fixed-size texture cache in the GPU.
When you create mipmaps in a third-party tool and include them in a .dds file, Kanzi Studio extracts the images for mipmap levels and uses them.
Avoid creating mipmaps from .jpeg textures, because the .jpeg image format causes the quality of the mipmaps to degrade.
Generating mipmaps for a texture
When you import an image that does not contain mipmaps, you can generate the mipmaps for the texture from that image in Kanzi Studio.
To generate mipmaps for a texture:
- In the Library select Resource Files > Images, and select the image for which you want to create mipmaps.
Avoid creating mipmaps from .jpeg textures, because the .jpeg image format causes the quality of the mipmaps to degrade.
- In the Properties enable the Generate Mipmaps property.
-
In the Library right-click the image for which you want to create mipmaps and select Preprocess images.
Kanzi Studio generates mipmaps for the image you selected.
Preprocess the images for which you want to generate mipmaps, because otherwise Kanzi Engine has to create the mipmaps when loading your application, which increases the loading time of your application. Note that Kanzi Engine cannot generate mipmaps for ETC compressed images.
- In the Library > Materials and Textures > Textures select the texture that uses the image for which you generated mipmaps and in the Properties set the Mipmap Mode property either to Linear or Nearest to take the mipmaps into use. See Filtering textures.
Creating mipmaps for a Render Target Texture
When you use a Render Target Texture on 3D geometry, you can create mipmaps in the Legacy Render Pass (deprecated) that renders the Render Target Texture.
To create mipmaps for a Render Target Texture:
- In the Library > Materials and Textures > Textures select the Render Target Texture for which you want to generate mipmaps, and in the Properties set the Mipmap Mode property to either Linear or Nearest. See Filtering textures.
- You can let the Legacy Render Pass (deprecated) generate mipmaps, or create custom mipmap levels:
- To let the Legacy Render Pass (deprecated) generate mipmaps, in the Library > Rendering > Render Passes select the Legacy Render Pass (deprecated) which you use to render that Render Target Texture, and in the Properties enable the Generate Mipmaps property.
If you use more than one Legacy Render Pass (deprecated), enable the Generate Mipmaps property only for the last Legacy Render Pass (deprecated) that renders to the Render Target Texture. Make sure that the Mipmap Level is set to 0.
or- To create a custom mipmap for each mipmap level, in the Library > Rendering > Render Passes create one Legacy Render Pass (deprecated) for each mipmap level, and set the Mipmap Level property to the mipmap level in which you want to use the result of that Legacy Render Pass (deprecated).
For example, if your Render Target Texture measures 512 by 512 pixels, to create all mipmap levels you need ten Legacy Render Pass (deprecated) render passes. For the Legacy Render Pass (deprecated) that renders the mipmap the size of the texture set the Mipmap Level property to 0, for the Legacy Render Pass (deprecated) that renders the next mipmap level (256 by 256 pixels) set the Mipmap Level property to 1, and so on until the mipmap texture that measures 1 by 1 pixel.
See also
Adjusting the data size
Loading resources in parallel
Compressing textures
Filtering textures
Troubleshooting the performance of your application
Images and textures best practices
Best practices
Open topic with navigation